
/*
// 用于解决I2C 互斥问题
*/
#include <stdbool.h> 
#include "i2c_mutex.h"


#include "boards.h"

#include "rtl876x.h"
#include "rtl876x_i2c.h"
#include "rtl876x_pinmux.h" 

#include "app_section.h"
#include "os_sched.h"

static volatile bool m_i2c_is_locked = false; 
DATA_RAM_FUNCTION
inline void i2c_set_locked(void)
{
    m_i2c_is_locked = true; 
}
DATA_RAM_FUNCTION
inline void i2c_unset_locked(void)
{
    m_i2c_is_locked = false; 
}
DATA_RAM_FUNCTION
inline bool i2c_check_is_locked(void)
{
    while(m_i2c_is_locked)
    {
        os_delay(1);
    }
    return m_i2c_is_locked;
}

